const path = require('path');
function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  publicPath: process.env.VUE_APP_BASE,
  outputDir: `dist${process.env.VUE_APP_BASE}`,
  assetsDir: 'static',
  lintOnSave: false,
  filenameHashing: false,
  css: {
    extract: true,
  },
  configureWebpack: {
    resolve: {
      extensions: ['.js', '.json', '.vue'],
      alias: {
        '@': path.resolve(__dirname, 'src/'),
      },
    }
  },
  chainWebpack: (config) => {
    config.optimization.delete('splitChunks');
    config.module
      .rule('svg')
      .exclude.add(resolve('src/assets/icons'))
      .end()
    config.module
      .rule('icons')
      .test(/\.svg$/)
      .include.add(resolve('src/assets/icons'))
      .end()
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .options({
        symbolId: 'icon-[name]'
      })
      .end();
  },
  devServer: {
    host: '0.0.0.0',
    port: 8080,
    open: true,
    proxy: {
      "/idaas": {
        target: `http://10.21.21.22:8800`,
        changeOrigin: true,
        pathRewrite: {
        }
      }
    },
    disableHostCheck: true
  }
};
